package com.itheima_text;

public class Demo2 {
    public static void main(String[] args) {
        long num = factorial(10);
        System.out.println(num);
    }

    public static long factorial(int n) {
        //1的阶乘已知 -- 出口
        if (n == 1) {
            return 1;
        } else {
            //n的阶乘就等于 n * (n-1)!
            return n * factorial(n - 1);
        }
    }
}
